/*
 * VisualClassComponentClaseAbstracta.cpp
 *
 *  Created on: May 29, 2013
 *      Author: root
 */

#include "gui/VisualComponents/clases/VisualClassComponentClaseAbstracta.h"
#include "model/clases/ClaseAbstracta.h"

VisualClassComponentClaseAbstracta::VisualClassComponentClaseAbstracta(Diagram *diagram) : VisualDiagramComponent(diagram), VisualClassesComponent(diagram) {
	m_component = new ClaseAbstracta();
	initialize();
}

VisualClassComponentClaseAbstracta::~VisualClassComponentClaseAbstracta() {
	// TODO Auto-generated destructor stub
}

InfluenceArea VisualClassComponentClaseAbstracta::getInfluenceArea() {
	return InfluenceRectangle(getX(), getY(), getX() + ENTITY_INFLUENCE_RECTANGLE_XF, getY() + ENTITY_INFLUENCE_RECTANGLE_YF);
}

void VisualClassComponentClaseAbstracta::draw(Cairo::RefPtr<Cairo::Context> ptrContext){
//	std::cout << "DRAW: VisualClassComponentClase:" << m_component->getName() << std::endl;
	// TODO: implementar !!!
	ptrContext->save();

	int x = getX();
	int y = getY();

	if (m_selected)
		ptrContext->set_source_rgb(0, 1, 0);
	else
		ptrContext->set_source_rgb(0, 0, 0);
	ptrContext->set_line_width(ANCHO_DE_LINEA);
	ptrContext->rectangle(x + CONECTOR_RADIUS, y, ENTITY_HORIZONTAL_LINE*2, ENTITY_VERTICAL_LINE);
	ptrContext->stroke_preserve();
	ptrContext->set_source_rgb(COLOR_COMPONENT);
	ptrContext->fill();
	ptrContext->restore();
	VisualDiagramComponent::draw( ptrContext);
	Draw draw;

	draw.writeTextInContext(ptrContext, x + (ENTITY_INFLUENCE_RECTANGLE_XF) / 2, y + (ENTITY_INFLUENCE_RECTANGLE_YF) / 1.5, m_component->description(), COLOR_IN_TEXT);
}

